package fr.rinie.android_first_step;//


import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

public class FishContainer {
    public static class Fish implements Serializable {
        private  static final long serialVersionUID = 1L;
        public String scientificName;
        public List<String> commonName;
        public String describer;
        public String family;
        public Fish.Temperature temperature;
        public Acidity acidity;
        public Hardness hardness;
        public Size size;
        public String lifeExpectancy;
        public String lifeZone;
        public String origin;
        public String description;
        public String dimorphism;
        public String behaviour;
        public String reproduction;

        public String toString() {
            return scientificName + getFormatedCommonName();
        }
        public String getFormatedCommonName() {
            return getFormatedCommonName(null);
        }
        public String getFormatedCommonName(String prefix) {
            if (commonName.isEmpty()) {
                return null;
            }
            StringBuilder sb = new StringBuilder();
            if (null != prefix) {
                sb.append(prefix);
            }
            for (String current : commonName) {
                sb.append(current);
                sb.append(", ");
            }
            String nomCommun = sb.toString();
            nomCommun = nomCommun.substring(0, nomCommun.length() - 2);
            nomCommun = nomCommun + ".";
            return nomCommun;
        }

        public static class Acidity implements Serializable {
            public BigDecimal phMin;
            public BigDecimal phMax;
            public BigDecimal phRepro;
        }

        public static class Hardness implements Serializable {
            public BigDecimal ghMin;
            public BigDecimal ghMax;
            public BigDecimal ghRepro;
        }

        public static class Size implements Serializable {
            public BigDecimal malSize;
            public BigDecimal femaleSize;
        }

        public static class Temperature implements Serializable {

            public BigDecimal tempMin;
            public BigDecimal tempMax;
            public BigDecimal tempRepro;
        }

    }

}
